<!-- 质检记录 -->
<template>
  <div class="qualityInspectionRecords">
    <div class="qualityInspectionRecords-header">
      <div class="qualityInspectionRecords-header-btn">
        <el-button size="mini">导出</el-button>
      </div>
      <div class="qualityInspectionRecords-header-info">
        <!-- <div class="qualityInspectionRecords-header-info-item">
          <span>需求总量：</span>
          <span>90</span>
        </div> -->
        <!-- <div class="qualityInspectionRecords-header-info-item">
          <span>领用总量：</span>
          <span>0</span>
        </div> -->
        <!-- <div class="qualityInspectionRecords-header-info-item">
          <span>退料总量：</span>
          <span>0</span>
        </div> -->
      </div>
    </div>
    <div class="qualityInspectionRecords-main">
      <el-table :data="data" border style="width: 100%" >
        <el-table-column type="index" label="序号" width="50"/>
        <el-table-column prop="ipqcName" label="检验单名称" ></el-table-column>
        <el-table-column prop="ipqcCode" label="检验单号" ></el-table-column>
        <el-table-column prop="taskName" label="任务名称" ></el-table-column>
        <el-table-column prop="taskCode" label="任务编号" ></el-table-column>
        <el-table-column prop="workstationName" label="站点名称" ></el-table-column>
        <el-table-column prop="processName" label="工序名称" ></el-table-column>
        <el-table-column prop="teamName" label="班组名称" ></el-table-column>
        <!-- <el-table-column prop="unit" label="任务负责人" ></el-table-column> -->
        <el-table-column prop="fbNickName" label="报工人员" ></el-table-column>
        <el-table-column prop="quantityFeedback" label="报工数量" ></el-table-column>
        <el-table-column prop="feedbackTime" label="报工时间" >
          <template slot-scope="scope">
            {{ parseTime(scope.row.feedbackTime, '{y}-{m}-{d} {h}:{i}:{s}')}}
          </template>
        </el-table-column>
        <el-table-column prop="ipqcTypeDesc" label="检验类型" ></el-table-column>
        <el-table-column prop="inspectDate" label="检验日期" >
          <template slot-scope="scope">
            {{ parseTime(scope.row.inspectDate, '{y}-{m}-{d}')}}
          </template>
        </el-table-column>
        <!-- <el-table-column prop="unit" label="检验部门" ></el-table-column> -->
        <el-table-column prop="inspector" label="检验人" ></el-table-column>
        <el-table-column prop="quantityCheck" label="检测数量" ></el-table-column>
        <el-table-column prop="quantityQualified" label="合格数量" ></el-table-column>
        <el-table-column prop="quantityUnqualified" label="不合格数量" ></el-table-column>
        <!-- <el-table-column prop="unit" label="合格率" ></el-table-column> -->
        <el-table-column prop="checkResultDesc" label="检验结果" ></el-table-column>
        <el-table-column  label="操作" >
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click="handleEdit(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-dialog title="详情" :visible.sync="dialogVisible" width="70%">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column label="检测项名称" width="120px" align="center" prop="indexName" />
        <el-table-column label="检测项类型" width="100px" align="center" prop="indexType">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.mes_index_type" :value="scope.row.indexType"/>
          </template>
        </el-table-column>
        <el-table-column label="检测工具" align="center" prop="qcTool" />
        <el-table-column label="检测要求" align="center" prop="checkMethod" />
        <el-table-column label="标准值" align="center" prop="standerVal" />
        <el-table-column label="单位" align="center" prop="unitOfMeasure" />
        <el-table-column label="误差上限" align="center" prop="thresholdMax" />
        <el-table-column label="误差下限" align="center" prop="thresholdMin" />
        <el-table-column label="致命缺陷数量" align="center" prop="crQuantity" />
        <el-table-column label="严重缺陷数量" align="center" prop="majQuantity" />
        <el-table-column label="轻微缺陷数量" align="center" prop="minQuantity" />
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { listIpqcline } from "@/api/mes/qc/ipqcline";
export default {
  name: 'qualityInspectionRecords',
  dicts: ['mes_index_type'],
  props: {
    data: undefined
  },
  data() {
    return {
      tableData: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        ipqcId: undefined
      },
      total: 0,
      dialogVisible: false,
    }
  },
  created() {},
  methods: {
    handleEdit(row){
      this.dialogVisible = true
      this.queryParams.ipqcId = row.ipqcId
      this.getList()
      console.log(row);
    },
    getList() {
      listIpqcline(this.queryParams).then(res => {
        this.tableData = res.rows
        this.total = res.total
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.qualityInspectionRecords {
  &-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    // padding: 0 20px;
    &-btn {
      display: flex;
    }
    &-info {
      display: flex;
      justify-content: space-between;
      &-item {
        display: flex;
        align-items: center;
        margin-right: 20px;
        span {
          font-size: 12px;
        }
      }
    }
  }
}
</style>